package com.hzmg.handler.http;

import akka.http.javadsl.model.ContentTypes;
import akka.http.javadsl.model.HttpRequest;
import akka.http.javadsl.model.Uri;
import com.hzmg.akkacloud.common.serialize.JsonUtils;
import com.hzmg.akkacloud.common.serialize.SerializerUtils;

import java.net.URI;

public class PostRequestHandler implements RequestDeal{
    @Override
    public HttpRequest viaRequestMethod(HttpRequest request) {
        String uri = request.getUri().toString();
        //TODO: 参数处理
        return HttpRequest.POST(uri)
                .withEntity(ContentTypes.APPLICATION_JSON, SerializerUtils.serialize(request.entity()));
    }
}
